<template>
  <div id="app" >
    <!--    路由出口-->
    
    
    <router-view />
  </div>
</template>
<script>
export default {
  name: "App",
  // vuex页面刷新数据丢失解决办法实现
  created() {
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("storeState", JSON.stringify(this.$store.state));
    });

    //在页面加载时读取sessionStorage里的状态信息
    if (sessionStorage.getItem("storeState")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("storeState"))
        )
      );
    }
  },
};
</script>
<style lang="less">
// 定义进度条颜色
#nprogress .bar {
  background: skyblue !important; //自定义颜色
}
.app{
  height: 100vh;

}
</style>
